package com.testfileupload.uploadimg.design.proxy.dynamic.dc2;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DynamicProxy<T> {
    private static  boolean flag = true;

    public static <T> T newProxyInstence(ClassLoader classLoader,
                                         Class<?>[] interfaces,
                                         InvocationHandler invocationHandler) {
        //寻找切点joinpoint
        if (flag){
            new BeforeAdvice().exec();
        }
        return (T) Proxy.newProxyInstance(classLoader, interfaces, invocationHandler);
    }
}
